import http from "@/config/http.js"

export default {
	//删除
	delsteelinfo: function(id) {
		let data = {
			id: id
		}
		return http.post("pro/factory/delete", data)
	},
	//所有信息钢厂无size
	async getsteelinfo() {
		try {
			let data = {
				code: 0,
				data: {},
				extraMsg: "string",
				msg: "string"
			}
			let res = await http.post("/pro/factory/findAll/noSize", data)
			return res
		} catch (err) {
			alert('请求出错！')
		}
	},
	//所有信息钢厂
	async getsteelinfoall(data) {
		try {
			let res = await http.post("/pro/factory/findAll", data)
			return res
		} catch (err) {
			alert('请求出错！')
		}
	},
	
	//添加
	async addsteelinfo(data) {
		try {
			let res = await http.post("/pro/factory/save", data)
			return res
		} catch (err) {
			alert('请求出错！')
		}
	},
	
	//编辑
	async editsteelinfo(data) {
		try {
			let res = await http.post("/pro/factory/update",data)
			return res
		} catch (err) {
			alert('请求出错！')
		}
	},
	
	//根据钢铁id查项目
	async getidInfo(id){
		try{
			let data = {
				id:id
			}
			let res = await http.post("/pro/findProListByFactory",data);
			if(res.status === 200){
				if(res.data.msg === 'success'){
					return res.data.data
				}
			}
		}catch(e){
			alert('请求出错！')
		}
	},
	
	//根据项目查询用户
	async getProuser(data){
		try{
			let res = await http.post("/user/findUserByPro",data);
			if(res.status === 200){
				if(res.data.msg === 'success'){
					return res
				}
			}
		}catch(e){
			alert('请求出错！')
		}
	},
	
	//根据钢厂id查询用户
	async getSteeluser(data){
		try{
			let res = await http.post("/user/findUserByFactory",data);
			if(res.status === 200){
				if(res.data.msg === 'success'){
					return res
				}
			}
		}catch(e){
			alert('请求出错！')
		}
	}
}
